const path = require('path')

function resolve(dir) {
    return path.join(__dirname, dir)
}
//打包报错：resolve is not defined需加以上配置解决

module.exports = {
    configureWebpack: {
        resolve: {
            extensions: [".js", ".vue", ".json", ".css", ".scss"],
            alias: {
                "@": resolve("src"),
            }
        }
    },
    lintOnSave: false,
    devServer: {
        //手机连接电脑热点即可访问，ip地址通过ipconfig查看
        // host: '192.168.0.110',
        port: 8080,
        https: false,
        open: false,
        proxy: {
            "/api": {
                target: "http://localhost:3000",
                changeOrigin: true,             //是否跨域
                secure: true,                   //是否https接口
                pathRewrite: {
                    "/api": ""
                }
            }
        }
    },
    //配置全局sass样式
    css: {
        loaderOptions: {
            sass: {
                additionalData: `@import '@/assets/style/mixin.scss';`
            }
        }
    }
}